(0) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

f(s(a), s(b), x) → f(x, x, x)
g(f(s(x), s(y), z)) → g(f(x, y, z))
cons(x, y) → x
cons(x, y) → y

Rewrite Strategy: INNERMOST

(1) DependencyGraphProof (BOTH BOUNDS(ID, ID) transformation)

The following rules are not reachable from basic terms in the dependency graph and can be removed:
g(f(s(x), s(y), z)) → g(f(x, y, z))

(2) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

cons(x, y) → x
cons(x, y) → y
f(s(a), s(b), x) → f(x, x, x)

Rewrite Strategy: INNERMOST

(3) TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID) transformation)

Transformed TRS to weighted TRS

(4) Obligation:

The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

cons(x, y) → x [1]
cons(x, y) → y [1]
f(s(a), s(b), x) → f(x, x, x) [1]

Rewrite Strategy: INNERMOST

(5) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)

Infered types.

(6) Obligation:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

cons(x, y) → x [1]
cons(x, y) → y [1]
f(s(a), s(b), x) → f(x, x, x) [1]

The TRS has the following type information:
cons :: cons → cons → cons
f :: s → s → s → f
s :: a:b → s
a :: a:b
b :: a:b

Rewrite Strategy: INNERMOST

(7) CompletionProof (UPPER BOUND(ID) transformation)

The TRS is a completely defined constructor system, as every type has a constant constructor and the following rules were added:

f(v0, v1, v2) → null_f [0]

And the following fresh constants:

null_f, const, const1

(8) Obligation:

Runtime Complexity Weighted TRS where all functions are completely defined. The underlying TRS is:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

cons(x, y) → x [1]
cons(x, y) → y [1]
f(s(a), s(b), x) → f(x, x, x) [1]
f(v0, v1, v2) → null_f [0]

The TRS has the following type information:
cons :: cons → cons → cons
f :: s → s → s → null_f
s :: a:b → s
a :: a:b
b :: a:b
null_f :: null_f
const :: cons
const1 :: s

Rewrite Strategy: INNERMOST

(9) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID) transformation)

Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction.
The constant constructors are abstracted as follows:

a => 0
b => 1
null_f => 0
const => 0
const1 => 0

(10) Obligation:

Complexity RNTS consisting of the following rules:

cons(z, z') -{ 1 }→ x :|: x >= 0, y >= 0, z = x, z' = y
cons(z, z') -{ 1 }→ y :|: x >= 0, y >= 0, z = x, z' = y
f(z, z', z'') -{ 1 }→ f(x, x, x) :|: z' = 1 + 1, z = 1 + 0, x >= 0, z'' = x
f(z, z', z'') -{ 0 }→ 0 :|: v0 >= 0, z'' = v2, v1 >= 0, z = v0, z' = v1, v2 >= 0

Only complete derivations are relevant for the runtime complexity.

(11) CompleteCoflocoProof (EQUIVALENT transformation)

Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo:

eq(start(V, V1, V6),0,[cons(V, V1, Out)],[V >= 0,V1 >= 0]).
eq(start(V, V1, V6),0,[f(V, V1, V6, Out)],[V >= 0,V1 >= 0,V6 >= 0]).
eq(cons(V, V1, Out),1,[],[Out = V2,V2 >= 0,V3 >= 0,V = V2,V1 = V3]).
eq(cons(V, V1, Out),1,[],[Out = V4,V5 >= 0,V4 >= 0,V = V5,V1 = V4]).
eq(f(V, V1, V6, Out),1,[f(V7, V7, V7, Ret)],[Out = Ret,V1 = 2,V = 1,V7 >= 0,V6 = V7]).
eq(f(V, V1, V6, Out),0,[],[Out = 0,V8 >= 0,V6 = V9,V10 >= 0,V = V8,V1 = V10,V9 >= 0]).
input_output_vars(cons(V,V1,Out),[V,V1],[Out]).
input_output_vars(f(V,V1,V6,Out),[V,V1,V6],[Out]).

CoFloCo proof output:
Preprocessing Cost Relations
=====================================

#### Computed strongly connected components
0. non_recursive : [cons/3]
1. recursive : [f/4]
2. non_recursive : [start/3]

#### Obtained direct recursion through partial evaluation
0. SCC is partially evaluated into cons/3
1. SCC is partially evaluated into f/4
2. SCC is partially evaluated into start/3

Control-Flow Refinement of Cost Relations
=====================================

### Specialization of cost equations cons/3
* CE 5 is refined into CE [8]
* CE 4 is refined into CE [9]


### Cost equations --> "Loop" of cons/3
* CEs [8] --> Loop 6
* CEs [9] --> Loop 7

### Ranking functions of CR cons(V,V1,Out)

#### Partial ranking functions of CR cons(V,V1,Out)


### Specialization of cost equations f/4
* CE 7 is refined into CE [10]
* CE 6 is refined into CE [11]


### Cost equations --> "Loop" of f/4
* CEs [11] --> Loop 8
* CEs [10] --> Loop 9

### Ranking functions of CR f(V,V1,V6,Out)

#### Partial ranking functions of CR f(V,V1,V6,Out)


### Specialization of cost equations start/3
* CE 2 is refined into CE [12,13]
* CE 3 is refined into CE [14]


### Cost equations --> "Loop" of start/3
* CEs [12,13,14] --> Loop 10

### Ranking functions of CR start(V,V1,V6)

#### Partial ranking functions of CR start(V,V1,V6)


Computing Bounds
=====================================

#### Cost of chains of cons(V,V1,Out):
* Chain [7]: 1
with precondition: [V=Out,V>=0,V1>=0]

* Chain [6]: 1
with precondition: [V1=Out,V>=0,V1>=0]


#### Cost of chains of f(V,V1,V6,Out):
* Chain [9]: 0
with precondition: [Out=0,V>=0,V1>=0,V6>=0]

* Chain [8,9]: 1
with precondition: [V=1,V1=2,Out=0,V6>=0]


#### Cost of chains of start(V,V1,V6):
* Chain [10]: 1
with precondition: [V>=0,V1>=0]


Closed-form bounds of start(V,V1,V6):
-------------------------------------
* Chain [10] with precondition: [V>=0,V1>=0]
- Upper bound: 1
- Complexity: constant

### Maximum cost of start(V,V1,V6): 1
Asymptotic class: constant
* Total analysis performed in 58 ms.

(12) BOUNDS(1, 1)